import { Component, ViewChild, ElementRef } from '@angular/core';
import {  NavController, NavParams,ViewController } from 'ionic-angular';
declare var AMap;
/**
 * Generated class for the OpenmapPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */


@Component({
  selector: 'page-openmap',
  templateUrl: 'openmap.html',
})
export class OpenmapPage {
  @ViewChild('mapContainer') mapContainer: ElementRef;
  map: any;//地图对象
  public showArr=[
  {
     text:'1.引入地图',
     tips:'index页面'
    },
    {
      text:'2.创建容器',
      tips:'html页面'
     },
     {
       text:'3.创建对象',
       tips:'js页面'
      }
  ]
  
  constructor(public navCtrl: NavController,  public viewCtrl:ViewController, public navParams: NavParams) {
  }
  dismiss(){
    this.viewCtrl.dismiss();
  }

  ionViewDidEnter() {
    console.log('ionViewDidLoad OpenmapPage');

    this.map = new AMap.Map(this.mapContainer.nativeElement, {
      view: new AMap.View2D({//创建地图二维视口
        zoom: 11, //设置地图缩放级别
        rotateEnable: true,
        showBuildingBlock: true
      })
    });
  }

}
